package cus1156.lab6;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class CatListTest {
    private CatList list;
    
	@Before
	public void setUp() throws Exception {
		list = new CatList();
	}

	@Test
	public void testAddCat() {
		//list = new CatList();
		list.addCat(new Cat("Joe", "orange",""));
		list.addCat(new Cat("Fluffy", "calico",""));
		assertEquals(list.getCatAtPos(0).getName(), "Joe");
		assertEquals(list.getCatAtPos(1).getName(), "Fluffy");
	}

	@Test
	public void testHowManyCats() {
		//list = new CatList();
		list.addCat(new Cat());
		list.addCat(new Cat());
		assertEquals(list.howManyCats(),2);
		list.addCat(new Cat());
		assertEquals(list.howManyCats(),3);
	}
	
	@Test
	public void testCountCatbyColor()//getCatColor
	
	{
		//list = new CatList();
		list.addCat(new Cat("Joe", "orange",""));
		list.addCat(new Cat("Fluffy", "calico",""));
		list.addCat(new Cat("Joe2", "orange",""));
		list.addCat(new Cat("Fluffy2", "red",""));
		list.addCat(new Cat("Joe3", "orange",""));
		list.addCat(new Cat("Fluffy3", "black",""));
		assertEquals(list.CountCatbyColor("orange"), 3);
		
	}

	@Test
	public void testGetCatbyName()//getCatName
	
	{
		//list = new CatList();
		list.addCat(new Cat("Joe", "orange",""));
		list.addCat(new Cat("Fluffy", "calico",""));
		list.addCat(new Cat("Joe2", "orange",""));
		list.addCat(new Cat("Fluffy2", "red",""));
		list.addCat(new Cat("Joe3", "orange",""));
		list.addCat(new Cat("Fluffy3", "black",""));
		System.out.println("\n\n In Test:");
		System.out.println(list.getCatByName("Joe"));
		assertEquals(list.getCatByName("Joe").length(), 4);
				
	}

}
